package com.takusemba.jethub.extension

import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations

/**
 *  Uses `Transformations.map` on a LiveData
 */
fun <X, Y> LiveData<X>.map(body: (X) -> Y): LiveData<Y> {
  return Transformations.map(this, body)
}

/**
 * Uses `Transformations.switchMap` on a LiveData
 */
fun <X, Y> LiveData<X>.switchMap(body: (X) -> LiveData<Y>): LiveData<Y> {
  return Transformations.switchMap(this, body)
}